import { createRouter, createWebHistory, createWebHashHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

//导入账号管理
import ManagerIndexView from '@/views/manager/ManagerIndexView.vue'
import ManagerListView from '@/views/manager/ManagerListView.vue'
import UserListView from '@/views/manager/UserListView.vue'

//导入轮播图管理
import BannerIndexView from '@/views/banner/BannerIndexView.vue'
import BannerListView from '@/views/banner/BannerListView.vue'
import AddBannerView from '@/views/banner/AddBannerView.vue'

//导入商品管理
import ProIndexView from '@/views/pro/ProIndexView.vue'
import ProListView from '@/views/pro/ProListView.vue'
import RecommendProList from '@/views/pro/RecommendProList.vue'
import SeckillProList from '@/views/pro/SeckillProList.vue'

//导入图标管理
import EchartsIndexView from '@/views/echarts/EchartsIndexView.vue'
import EchartsShowView from '@/views/echarts/EchartsShowView.vue'
import EchartsTestView from '@/views/echarts/EchartsTestView.vue'

//导入文件管理
import ExcelExportView from '@/views/excel/ExcelExportView.vue'
import ExcelImportView from '@/views/excel/ExcelImportView.vue'
import ExcelIndexView from '@/views/excel/ExcelIndexView.vue'

//导入富文本管理
import EditorIndexView from '@/views/editor/EditorIndexView.vue'
import EditorShowView from '@/views/editor/EditorShowView.vue'

//导入地图管理
import MapIndexView from '@/views/map/MapIndexView.vue'
import BdMapShowView from '@/views/map/BdMapShowView.vue'
import GdMapShowView from '@/views/map/GdMapShowView.vue'




export const routes =[
    {
      //页面的路由路径
      path: '/',
      // 路由的别名，命名路由
      name: 'home',
      label:'首页',
      // 路由路径所对应的页面组件
      component: HomeView,
      //路由的嵌套，配置子路由
      //二级路由
      children:[
      {
        path:'manager',
        name:'manager',
        label:'账号管理',
        icon:'HomeFilled',
        component:ManagerIndexView,
        //三级路由
        children:
        [
          {
            path:'managerList',
            name:'managerList',
            label:'管理员列表',
            icon:'UserFilled',
            component:ManagerListView
          },
          {
            path:'userList',
            name:'userList',
            label:'用户列表',
            icon:'UserFilled',
            component:UserListView
          },
        ]
      },
      {
        path:'banner',
        name:'banner',
        label:'轮播图管理',
        icon:'PictureFilled',
        component:BannerIndexView,
        //三级路由
        children:
        [
          {
            path:'bannerList',
            name:'bannerList',
            label:'轮播图列表', 
            icon:'PictureFilled',
            component:BannerListView
          },
          {
            path:'addBanner',
            name:'addBanner',
            label:'添加轮播图',
            icon:'PictureFilled',
            component:AddBannerView
          },
        ]
      },
      {
        path:'pro',
        name:'pro',
        label:'商品管理',
        icon:'GoodsFilled',
        component:ProIndexView,
        //三级路由
        children:
        [
          {
            path:'proList',
            name:'proList',
            label:'商品列表',
            icon:'GoodsFilled',
            component:ProListView
          },
          {
            path:'RecommendProList',
            name:'RecommendProList',
            label:'推荐列表',
            icon:'GoodsFilled',
            component:RecommendProList
          },
          {
            path:'SeckillProList',
            name:'SeckillProList',
            label:'秒杀列表',
            icon:'GoodsFilled',
            component:SeckillProList
          },
        ]
      },
      {
        path:'echarts',
        name:'echarts',
        label:'图表管理',
        icon:'TrendCharts',
        component:EchartsIndexView,
        //三级路由
        children:
        [
          {
            path:'echartsShow',
            name:'echartsShow',
            label:'图表显示',
            icon:'TrendCharts',
            component:EchartsShowView
          },
          {
            path:'echartsTest',
            name:'echartsTest',
            label:'特殊图表',
            icon:'TrendCharts',
            component:EchartsTestView
          },
        ]
      },
      {
        path:'excel',
        name:'excel',
        label:'文件管理',
        icon:'Folder',
        component:ExcelIndexView,
        //三级路由
        children:
        [
          {
            path:'import',
            name:'import',
            label:'文件导入',
            icon:'Folder',
            component:ExcelImportView
          },
          {
            path:'export',
            name:'export',
            label:'文件导出',
            icon:'Folder',
            component:ExcelExportView
          },
        ]
      },
      {
        path:'editor',
        name:'editor',
        label:'编辑器管理',
        icon:'Edit',
        component:EditorIndexView,
        //三级路由
        children:
        [
          {
            path:'editorShow',
            name:'editorShow',
            label:'富文本编辑器',
            icon:'Edit',
            component:EditorShowView
          },
        ]
      },
      {
        path:'map',
        name:'map',
        label:'地图管理',
        icon:'Location',
        component:MapIndexView,
        //三级路由
        children:
        [
          {
            path:'BdmapShow',
            name:'BdmapShow',
            label:'百度地图',
            icon:'Location',
            component:BdMapShowView
          },{
            path:'GdmapShow',
            name:'GdmapShow',
            label:'高德地图',
            icon:'Location',
            component:GdMapShowView
          },
        ]
      }
    ]
    },
    {
      path: '/login',
      name: 'login',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
       // 路由的懒加载，对于一些不确定是非需要立即显示的页面，可以使用路由懒加载
      component: () => import('../views/LoginView.vue')
    }
  ]

const router = createRouter({
  // 配置路由模式
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes
})

export default router
